/*
 * @Description:: 请补充填写
 * @Version: 请配置版本号
 * @Author: xiaobai
 * @Date: 2020-08-30 07:59:10
 * @LastEditors: smallWhite
 * @LastEditTime: 2024-07-02 15:13:03
 * @FilePath: /huizhou_website_admin/src/router/index.js
 */
import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  // {
  //   path: '/index',
  //   component: Layout,
  //   redirect: '/index',
  //   auth: 'all',
  //   children: [
  //     {
  //       path: 'index',
  //       name: '导航管理',
  //       component: () => import('@/views/index/index'),
  //       meta: { title: '导航管理', icon: 'el-home' }
  //     }
  //   ]
  // },
  // {
  //   path: '/index',
  //   component: Layout,
  //   redirect: '/index',
  //   auth: 'all',
  //   children: [
  //     {
  //       path: 'index',
  //       name: '测试',
  //       component: () => import('@/views/test/index'),
  //       meta: { title: '测试', icon: 'el-home' }
  //     }
  //   ]
  // },
  {
    path: '/',
    component: Layout,
    redirect: '/banner_management',
    auth: 'all',
    children: [
      {
        path: 'banner_management',
        name: '图片管理',
        component: () => import('@/views/home/index'),
        meta: { title: '图片管理', icon: 'el-icon-picture-outline' }
      }
    ]
  },
  {
    path: '/about_us',
    component: Layout,
    meta: { title: '集团概况', icon: 'el-icon-files' },
    redirect: '/about_us',
    children: [
      {
        path: 'company_profilees',
        name: '集团简介',
        meta: { title: '集团简介' },
        component: () => import('@/views/about_us/company_profilees/index')
      },
      {
        path: 'organizational',
        name: '组织架构',
        meta: { title: '组织架构' },
        component: () => import('@/views/about_us/organizational/index')
      },
      {
        path: 'department',
        name: '部门职责',
        meta: { title: '部门职责' },
        component: () => import('@/views/about_us/department/index')
      }
    ]
  },
  {
    path: '/information',
    component: Layout,
    meta: { title: '信息公开', icon: 'el-icon-bell' },
    redirect: '/information',
    children: [
      {
        path: 'notice_management',
        name: '公告公示',
        component: () => import('@/views/information/notice_management/index'),
        meta: { title: '公告公示' }
      },
      {
        path: 'leaderjob',
        name: '干部管理',
        meta: { title: '干部管理' },
        component: () => import('@/views/information/leaderjob/index')
      },
      {
        path: 'recruitment_management',
        name: '人才招聘',
        component: () => import('@/views/information/recruitment_management/index'),
        meta: { title: '人才招聘' }
      }
    ]
  },
  {
    path: '/party',
    component: Layout,
    meta: { title: '党群工作', icon: 'el-icon-postcard' },
    redirect: '/party',
    children: [
      {
        path: 'party_building',
        name: '党群工作',
        component: () => import('@/views/party/party_building/index'),
        meta: { title: '党群工作' }
      },
      {
        path: 'party_setting',
        name: '党群设置',
        component: () => import('@/views/party/party_setting/index'),
        meta: { title: '党群设置' }
      }
      // {
      //   path: 'party_job',
      //   name: '群团工作',
      //   component: () => import('@/views/party/party_job/index'),
      //   meta: { title: '群团工作' }
      // },
      // {
      //   path: 'parth_builds',
      //   name: '党风廉政建设',
      //   component: () => import('@/views/party/parth_builds/index'),
      //   meta: { title: '党风廉政建设' }
      // }
    ]
  },
  {
    path: '/news_management',
    component: Layout,
    redirect: '/news_management',
    auth: 'all',
    children: [
      {
        path: 'news_management',
        name: '新闻中心',
        component: () => import('@/views/news_management/index'),
        meta: { title: '新闻中心', icon: 'el-icon-tickets' }
      }
    ]
  },
  {
    path: '/project_menagement',
    component: Layout,
    redirect: '/project_menagement',
    auth: 'all',
    children: [
      {
        path: 'project_menagement',
        name: '业务版块',
        component: () => import('@/views/project_menagement/index'),
        meta: { title: '业务版块', icon: 'el-icon-folder-opened' }
      }
    ]
  },
  {
    path: '/contact_us',
    component: Layout,
    redirect: '/contact_us',
    auth: 'all',
    children: [
      // {
      //   path: 'contact_us',
      //   name: '联系我们',
      //   component: () => import('@/views/about_us/contact_us/index'),
      //   meta: { title: '联系我们', icon: 'el-icon-folder-opened' }
      // }，
      {
        path: 'link_us',
        name: '友情链接',
        component: () => import('@/views/about_us/link_us/index'),
        meta: { title: '友情链接', icon: 'el-icon-folder-opened' }
      }
    ]
  },
  //
  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true }
]

const createRouter = () =>
  new Router({
    // mode: 'history', // require service support
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes
  })

const router = createRouter()
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
